package cn.tedu.spring.dilistmap;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestTeacher {

    // 1.List集合测试方法
    @Test
    public void ListSetTest(){
        ApplicationContext context = new ClassPathXmlApplicationContext("bean-dilistmap.xml");
        Teacher teacher = context.getBean("teacher", Teacher.class);
        System.out.println("teacher = " + teacher);
    }

    // 2.Map集合测试方法
    @Test
    public void MapSetTest(){
        ApplicationContext context = new ClassPathXmlApplicationContext("bean-dimap.xml");
        Student stuMap = context.getBean("stuMap", Student.class);
        System.out.println("stuMap = " + stuMap);
    }

    // 3.外部集合引用bean测试方法
    @Test
    public void UtilTest(){
        ApplicationContext context = new ClassPathXmlApplicationContext("bean-diref.xml");
        Student stuUtil = context.getBean("stuUtil", Student.class);
        System.out.println("stuUtil = " + stuUtil);
    }

    // 4.p命名空间测试方法
    @Test
    public void pTest(){
        ApplicationContext context = new ClassPathXmlApplicationContext("bean-diref.xml");
        Student studentp = context.getBean("studentp", Student.class);
        System.out.println("studentp = " + studentp);
    }
}
